﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChinessChess
{
    class CQTuong:CQuanCo
    {
        private int new_Index, old_Index;
        private int[] white= new int [9] {3,4,5,12,13,14,21,22,23};
        private int[] black = new int[9] { 66, 67, 68, 75, 76, 77, 84, 85, 86 };
        public CQTuong() { 
        
        }

        public CQTuong(COCo[] chess, int newIndex, int oldIndex, ChessColor color)
            : base(chess, color)
        {
            this.new_Index = newIndex;
            this.old_Index = oldIndex;
        }

        

        public override bool CheckIndex(){
            switch (Color) {
                case ChessColor.white:
                    {
                        if (white.Contains(new_Index))
                        {
                            if (Math.Abs(new_Index - old_Index) == 9 || Math.Abs(new_Index - old_Index) == 1)
                            {
                                return true;
                            }
                        }
                        break;
                    }
                case ChessColor.black:
                    {
                        if (black.Contains(new_Index))
                        {
                            if (Math.Abs(new_Index - old_Index) == 9 || Math.Abs(new_Index - old_Index) == 1)
                            {
                                return true;
                            }
                        }
                        break;
                    }
            }
            return false;
        }
        
        public override bool CheckPoint()
        {
          
            return false;
        }
    }
    

}
